package com.chuanke.ckfamily.service.finance.impl.thread;

import com.chuanke.ckfamily.service.common.CacheService;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class CreateRedpacketThread {

    private static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(100, 1000, 3,
                                        TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(500),
				new ThreadPoolExecutor.DiscardOldestPolicy());

    public static void create(CacheService cacheService, Long pid, int num, Long money) {
        threadPool.execute(new CreatePacketRunnable(cacheService, pid, num, money));
    }
}
